﻿// --------------------------------
// <copyright file="LocalPCGamePadPlayer.cs" company="Faculty of Information Technology, Czech Technical University in Prague">
//     This document is shared by Microsoft Public License (MS-PL)
//     For further details please see http://msdn.microsoft.com/en-us/library/ff648068.aspx or license.txt.
// </copyright>
// <author>Vladislav Richter</author>

// <email>richtvl2@fit.cvut.cz</email>

// <date>9. 11. 2011 22:22:37</date>

// <summary>
//
// </summary>
// --------------------------------
#if WINDOWS

using ExternalClasses.Controls;
using Microsoft.Xna.Framework;
using Nuclex.Input;

namespace FITClub.Episode1.Controller
{
    /// <summary>
    /// Local player which uses PC game pad or an equivalent input device.
    /// </summary>
    internal class LocalPCGamePadPlayer : APlayer
    {
        private PlayerIndex index;
        private PCGamePadState ActualState;
        private ExtendedPlayerIndex Index;

        public LocalPCGamePadPlayer(string Name, ExtendedPlayerIndex index)
            : base(Name)
        {
            this.Index = index;
        }

        public override void Update()
        {
            base.Update();
            ActualState = PCGamePad.GetState(Index);
            base.SetState(ActualState.Up, (int)VirtualGamepadButtons.Up);
            base.SetState(ActualState.Left, (int)VirtualGamepadButtons.Left);
            base.SetState(ActualState.Down, (int)VirtualGamepadButtons.Down);
            base.SetState(ActualState.Right, (int)VirtualGamepadButtons.Right);
            base.SetState(ActualState.Attack, (int)VirtualGamepadButtons.Attack);
            base.SetState(ActualState.Block, (int)VirtualGamepadButtons.Defence);
        }

        public override void Dispose()
        {
            //throw new NotImplementedException();
        }
    }
}

#endif